1. Technical Field
The present invention generally relates to distributed data processing systems and in particular to server programming in distributed data processing systems with Enterprise JavaBeans™ (EJB) applications. Still more particularly, the present invention relates to a method, system, and program product that provides domain level business object keys in EJB applications.
2. Description of the Related Art
Java™ (Java) is a computing application developed for distributed computing with low (or little) administration and platform independence. The Java™ platform for enterprise-capable Java™ computing utilizes Enterprise JavaBeans™ (EJBean or EJB) (trademark of Sun Microsystems) technology that provides for the development and deployment of reusable server components. EJBean server components are individual specialized applications that run in an application server.
EJBeans are designed to support high scalability utilizing a multi-tier distributed application architecture (i.e., architecture that has multiple application components), and the multi-tier orientation provides many advantages over traditional client/server architectures. EJBean components contain no system level programming, include only business related logic, and are fully portable across any EJBean compliant server and any Operating System (OS).
A server component is a reusable software application that performs specific functions and is accessible to other applications through the server component's interface. Thus, a server component can be developed for one application and reused in another application. Server components are basic building blocks that have specific, published functions that may be combined with other components and applications into a configuration that performs a task designed by a developer.
Traditionally, a Java Virtual Machine (JVM) allows a Java application to run on any operating system, but server side components require proprietary programming interfaces based on vendor software and hardware. EJBean server components, however, are portable and virtually vendor-independent on all Java EJBean compliant application servers. With their server component portability, increased scalability, reliability, and re-usability, EJBean components can be moved from one execution environment to another without requiring any re-coding.
IBM's Websphere Application Server is an EJB server environment that provides support for the EJB specification. Websphere Application Server provides the quality of service prescribed by the EJB specification and allows developers to build enterprise application business objects using the EJB programming model. In Websphere Application Server, a component consists of a distributed set of objects that client applications access as a single entity. To a client application, a component appears to be a single class, with methods and attributes and relationships like any other class. Behind this single interface, however, each component consists of multiple objects on both the client and the server. This separation provides flexibility and control in the way data is stored and accessed and in the way that business processes are distributed. Thus, the objects can exist on any number of different servers and databases, but to the client they present a single interface, with a single set of attributes. Typically, a component consists of several primary types of objects. These primary object types are:
(1) business objects, which represents a business function; and
(2) application objects—business objects which are directing workflow and implementing some client initiated task. Specifically, in Websphere Application Server, an application object functions as part of an application component, which implements business logic and usage of other components similar to the way some application programs do today.
Business objects contain attributes that define the state of the object and methods that define the behavior of the object. A business object may also have relationships with other business objects and may cooperate with other business objects to perform a specific task. Business objects are independent of any individual application and may be utilized in any combination to perform a desired task. Typical examples of business objects are Customer, Invoice, and Account.
In Websphere Application Server, a business object functions as part of a component, which is a collection of related objects that work together to represent the logic and data relationships of the business function. A business object's interface and its implementation are defined in Java.
In Java, each object or enterprise Bean class exists as an EntityBean, by which a container may notify the enterprise Bean instances of the instance's life cycle events. The EJB architecture provides that an EntityBean must have a unique primary key. The primary key serves as a unique identifier and is utilized to locate the object. The EJB architecture also provides that the uniqueness of the primary key is scoped to the home that was chosen for the EntityBean class during deployment. Scoping of primary keys provides a straightforward mapping of the EntityBean's persistent state into an underlying database table. However, this straightforward mapping may not be sufficient in a robust, object-oriented business application.
In other words, keys provided in the business domain (i.e., “domain keys”) are often only unique within the scope of a processing context provided by another business object. For example, an application for a multi-company enterprise, such as IBM, may choose to scope Customer objects to Company objects, i.e., the identifiers (domain keys) of the Customer objects would only be unique within the scope of a Company object. The current EJB approach of scoping primary keys to homes, forces the use of different Customer homes for different Companies and exhibits several limitations including: (1) The approach makes it difficult to place customer instances from different companies into a single shared table because the primary key does not provide sufficient uniqueness; (2) The approach presents the application with the difficulty of finding the correct Customer home to use for a given Company object; and (3) If a new Company object is created, another deployment of the Customer class must be performed, which is unacceptable for an end user.
Therefore, the present invention recognizes that it would be desirable to provide a system, method, and program product that allows a business application to utilize domain level keys scoped to a Company to locate Customer objects while at the same time supporting a primary key for the Customer class that ensures uniqueness across Companies to enable reusable business components. A system, method and program product that is able to isolate business application code from the exact class of either the domain key or primary key of an EntityBean so that the deployer of the EntityBean class may determine the actual key classes used for the EntityBean would be a welcomed improvement. These and other benefits are provided by the present invention.